<?php
class Admin_Plugin_Bloc extends Zend_Controller_Plugin_Abstract {
	
	public function dispatchLoopShutdown() {
		$route = Zend_Controller_Front::getInstance ()->getRouter ()->getCurrentRouteName ();
		if (($route == 'admin') || ($route=='backend')) {
			$response = $this->getResponse ();
			$file = ROOT_PATH . "/site/settings/settings.ini";
			$values = new Zend_Config_Ini($file);
			$values = $values->toArray();
			if (isset ( $values ['production']['lock'] ) && ($values ['production']['lock'] != 0)) {
				if($values ['production']['loker'] != Zen_User::getId ()){
					$response->setBody ( "<h1 style='margin:200px auto;width:400px;font-size:28px;'>Панель администратора временно заблокирована, ведутся технические работы</h1>" );
				}
			}
		}
	}

}